package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.Travel;
import cn.wolfcode.trip.base.query.CollectQueryObject;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.query.TravelQueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface TravelMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Travel record);

    Travel selectByPrimaryKey(Long id);

    List<Travel> selectAll();

    int updateByPrimaryKey(Travel record);

    List<Travel> selectForLists(QueryObject qo);

    List<Travel> list(TravelQueryObject qo);

    void updateState(Travel t);

    List<Travel> selectTravelAndUserByAuthorId(TravelQueryObject qo);

    List<Travel> selectTravelsByStrategyId(Long strategyId);

    void deleteCollect(CollectQueryObject qo);

    void saveCollect(CollectQueryObject qo);

    Integer countCollect(@Param("travelId") Long travelId);

    Integer isCollect(@Param("userId") Long userId, @Param("travelId") Long travelId);

    List<Travel> selectCollectByUserId(@Param("userId") Long userId);

    void updateViewCount(@Param("travelId") Long travelId);

    Integer selectTravelCount(@Param("authorId") Long authorId);

    List<Map<String,Object>> selectTravelByKeyword(@Param("keyword") String keyword);
}